<?php
#设置品牌过期时间用于测试
ini_set('display_errors', 1);
error_reporting(-1);
require_once '/data/wwwroot/g_vendor/autoload.php';
ini_set('memory_limit', '512M');

use Biz\model\brandAccount\BrandAccountInfo;

$brandId = $argv[1] ?? null ;

var_dump(['brandId'=>$brandId]);

if(empty($brandId)){
    echo "brand id empty".PHP_EOL;
    exit;
}

$data['in_end_time'] = date('Y-m-d H:i:s',time() - 7*24*3600);

$where['brand_id'] = $brandId;
$where['account_status'] = BrandAccountInfo::ACCOUNT_STATUS_USED;

$infos = BrandAccountInfo::select('*',$where);

if(count($infos) != 1){
    echo "brand id error".PHP_EOL;
    exit;
}

$ret = BrandAccountInfo::update($data,$where);

echo BrandAccountInfo::sqlLogs().PHP_EOL;

if ($ret->errorCode() !== '00000') {
    echo "fail!".PHP_EOL;
    exit;
}

echo "success".PHP_EOL;




